﻿using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CadClient.CadHelpers
{
    public static class EditorHelper
    {
        /// <summary>
        /// 获取点
        /// </summary>
        /// <param name="ed"></param>
        /// <param name="promptStr"></param>
        /// <returns></returns>
        public static PromptPointResult GetPoint2(this Editor ed, string promptStr)
        {
            var ppo = new PromptPointOptions(promptStr);
            ppo.AllowNone = true;
            var ppr = ed.GetPoint(ppo);

            return ppr;
        }
        /// <summary>
        /// 获取点
        /// </summary>
        /// <param name="ed"></param>
        /// <param name="prompt"></param>
        /// <param name="pointBase"></param>
        /// <param name="keyWord"></param>
        /// <returns></returns>
        public static PromptPointResult GetPoint(this Editor ed, string prompt, Point3d pointBase, params string[] keyWord)
        {
            var ppo = new PromptPointOptions(prompt);
            ppo.AllowNone = true;
            for (int i = 0; i < keyWord.Length; i++)
                ppo.Keywords.Add(keyWord[i]);
            ppo.AppendKeywordsToMessage = false;
            ppo.BasePoint = pointBase;
            var ppr = ed.GetPoint(ppo);
            return ppr;
        }
    }
}
